home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / linuxcon.000 / linuxcon / linuxconf-1.6 / mailconf / mailconf.c < prev    next >
C/C++ Source or Header  |  1996-06-15  |  2KB  |  92 lines

  1. #pragma implementation
  2. #include "mailconf.h"
  3. #include "internal.h"
  4. #include "../netconf/netconf.h"
  5. #include "mailconf.m"
  6.  
  7. MAILCONF_HELP_FILE help_mailconf ("intro");
  8. extern CONFIG_FILE f_sendmail;
  9.  
  10. PUBLIC void MAILCONF::spcs_edit()
  11. {
  12.     if (spcs.edit() == 0){
  13.         spcs.build(features.dbformat.get());
  14.     }
  15. }
  16.  
  17. void mailconf_edit()
  18. {
  19.     /* #Specification: mailconf / main menu
  20.     */
  21.     int choice=0;
  22.     int modified = 0;
  23.     while (1){
  24.         static const char *basic = MSG_U(M_BASIC,"basic information");
  25.         static const char *spc_route = MSG_U(M_SPECIAL,"special (domain) routing");
  26.         static const char *cplx_route = MSG_U(M_COMPLEX,"complex (user) routing");
  27.         static const char *ualias = MSG_U(M_ALIASES,"user alias");
  28.         static const char *test_cases = MSG_U(M_TESTS,"test cases");
  29.         static const char *test_run = MSG_R(M_TESTS);
  30.         const char *sendpath = f_sendmail.getpath();
  31.         static const char *menuopt[]={
  32.             MSG_U(M_CONFIG,"Configure"),    basic,
  33.             " ",        spc_route,
  34.             " ",        cplx_route,
  35.             MSG_U(M_SETTING,"Setting"),    ualias,
  36.             "-",        "",
  37.             MSG_U(M_GENERATE,"Generate"),sendpath,
  38.             //"Preparing",    test_cases,
  39.             //"Run",        test_run,
  40.             NULL
  41.         };
  42.         MENU_STATUS code = xconf_menu (
  43.             MSG_U(T_SENDMAIL,"Sendmail configurator")
  44.             ,MSG_U(I_SENDMAIL
  45.              ,"This package allows you to configure\n"
  46.               "Sendmail, the mail delivery system\n")
  47.             ,help_mailconf
  48.             ,menuopt,choice);
  49.         if (code == MENU_QUIT || code == MENU_ESCAPE){
  50.             if (modified){
  51.                 char buf[100];
  52.                 sprintf (buf,MSG_U(Q_GENSENDMAIL,"Generating %s"),sendpath);
  53.                 if (xconf_yesno(buf
  54.                     ,MSG_U(I_GENSENDMAIL
  55.                      ,"You have modified sendmail's configuration.\n"
  56.                       "A new %s must be generated.\n"
  57.                       "Do you want to do it now")
  58.                     ,help_mailconf)){
  59.                     MAILCONF mconf;
  60.                     mconf.generate(false);
  61.                 }
  62.             }
  63.             break;
  64.         }else{
  65.             const char *key = menuopt[choice*2+1];
  66.             MAILCONF mconf;
  67.             if (key == basic){
  68.                 modified |= mconf.basicedit();
  69.             }else if (key == spc_route){
  70.                 mconf.spcs_edit();
  71.             }else if (key == cplx_route){
  72.                 modified |= complex_edit();
  73.             }else if (key == test_cases){
  74.             }else if (key == test_run){
  75.             }else if (key == ualias){
  76.                 aliases_edit();
  77.             }else if (key == sendpath){
  78.                 mconf.generate(false);
  79.                 modified = 0;
  80.             }
  81.         }
  82.     }
  83. }
  84.  
  85. int mailconf_main(int, char *[])
  86. {
  87.     mailconf_edit();
  88.     netconf_checkupdate();
  89.     return 0;
  90. }
  91.  
  92.